/**
 * JSparrow - Une version numérique du jeu "Attention Pirates !" - Copyright (C) 2014 Black Pearl
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program. If
 * not, see <http://www.gnu.org/licenses/>.
 */
package App.Modele;

import java.awt.Point;
import java.io.Serializable;
import java.util.ArrayList;

/**
 * Classe de gestion des cases.
 *
 * @author BlackPearl
 */
public class Case implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final Point coordonnees;
    private TypeCase type;
    private ArrayList<EntiteCase> entites;

    /**
     * Initalisation du contexte.
     *
     * @param x abscisse de la case
     * @param y ordonnée de la case
     */
    public Case(int x, int y) {
        this.coordonnees = new Point(x, y);
        this.entites = new ArrayList<EntiteCase>();
    }

    /**
     * Obtenir la liste des entités présentes sur la case.
     *
     * @return liste des entités
     */
    public ArrayList<EntiteCase> getEntites() {
        return this.entites;
    }

    /**
     * Connaître le type de la case.
     *
     * @return type de la case
     */
    public TypeCase getType() {
        return this.type;
    }
    
    public String toString(){
		StringBuffer caseStringBuffer = new StringBuffer();
		
			if(this.getType() == TypeCase.Mer){
				caseStringBuffer.append("Type : Mer; ");			
			}
			else if(this.getType() == TypeCase.Port){
				caseStringBuffer.append("Type : Port; ");	
			}
			else if(this.getType() == TypeCase.Terre){
				caseStringBuffer.append("Type : Terre; ");	
			}
			else{
				caseStringBuffer.append("Type : Vide; ");	
			}	

		return caseStringBuffer.toString();
	}
}
